@import '@material/chips/mixins.import';
@import '../mdc-helpers/mdc-helpers';
@import '@material/theme/functions.import';

@mixin mat-mdc-chips-theme($theme) {
  @include mdc-chip-set-core-styles($query: $mat-theme-styles-query);
  @include mdc-chip-without-ripple($query: $mat-theme-styles-query);

  $primary: mat-color(map-get($theme, primary));
  $accent: mat-color(map-get($theme, accent));
  $warn: mat-color(map-get($theme, warn));
  $background: map-get($theme, background);
  $unselected-background: mat-color($background, unselected-chip);

  .mat-mdc-chip {
    @include mdc-chip-fill-color-accessible($unselected-background,
      $query: $mat-theme-styles-query);

    &.mat-primary {
      &.mdc-chip--selected, &.mat-mdc-chip-highlighted {
        @include mdc-chip-fill-color-accessible($primary, $query: $mat-theme-styles-query);
      }
    }

    &.mat-accent {
      &.mdc-chip--selected, &.mat-mdc-chip-highlighted {
        @include mdc-chip-fill-color-accessible($accent, $query: $mat-theme-styles-query);
      }
    }

    &.mat-warn {
      &.mdc-chip--selected, &.mat-mdc-chip-highlighted {
        @include mdc-chip-fill-color-accessible($warn, $query: $mat-theme-styles-query);
      }
    }
  }
}

@mixin mat-mdc-chips-typography($config) {
  @include mdc-chip-set-core-styles($query: $mat-typography-styles-query);
  @include mat-using-mdc-typography($config) {
    @include mdc-chip-without-ripple($query: $mat-typography-styles-query);
  }
}
